from zeep import Client


#TODO 需要对用户密码进行MD5加密
def login(userName,loginIp,loginMac,password):
    ip = '47.102.200.101'
    port = 9000
    client = Client("http://%s:%s/?wsdl" % (ip, port))
    try:
        r = client.service.selectUserPasswordByName(str(userName),str(loginIp),str(loginMac))
        if (r[-1]=="200"):
            if(password==r[0]):
                return "True"
            #TODO 添加更详细的登录问题
            else:
                return str(r[-1])
    except:
        return "False"
